<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:oui="clr-namespace:OpenLS.UI"
    x:Class="OpenLS.UI.ScrollBarResources"
    >



  <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property ="Background" Value="Transparent"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border 
          Name="Border"
          Margin="1" 
          CornerRadius="2" 
          Background="{TemplateBinding Background}"
          BorderBrush="{DynamicResource {x:Static oui:OfficeBrushes.NormalBorderBrushKey}  }"
          BorderThickness="1">
            <Path 
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Fill="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarRepeatButtonGlyphBrushKey}}"
            Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="False">
              <Setter TargetName="Border" Property="BorderThickness" Value="0" />
              <Setter TargetName="Border" Property="CornerRadius" Value="0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarDisabledForegroundKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key ="VerticalScrollBarLineButton" TargetType="{x:Type RepeatButton}" 
  BasedOn="{StaticResource ScrollBarLineButton}">
    <Style.Triggers>
      <Trigger Property ="IsPressed" Value ="True">
                <Setter Property ="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalRepeatButtonPressedBackgroundKey}}"/>
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key ="HorizontalScrollBarLineButton" TargetType="{x:Type RepeatButton}" 
  BasedOn="{StaticResource ScrollBarLineButton}">
    <Style.Triggers>
      <Trigger Property ="IsPressed" Value ="True">
        <Setter Property ="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarHorizontalRepeatButtonPressedBackgroundKey}}"/>
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border 
          CornerRadius="2" 
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="1" >


            <Canvas Width ="8" Height ="8" SnapsToDevicePixels="True">
              <Path 
              Data ="M0,0 L0,8 M2,0 L2,8 M4,0 L4,8 M 6,0 L6,8"
              Stroke ="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarThumbGlyphBrushKey}}"/>
            </Canvas>

          </Border>
        </ControlTemplate>
      </Setter.Value>

    </Setter>

  </Style>
  <Style TargetType ="{x:Type Thumb}" x:Key="VerticalScrollBarThumb" BasedOn="{StaticResource ScrollBarThumb}">
        <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalThumbBackgroundKey}}"/>
    <Setter Property ="Margin" Value="1,0,1,0"/>
    <Setter Property ="BorderBrush" Value="{DynamicResource {x:Static oui:OfficeBrushes.NormalBorderBrushKey}  }"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border 
          CornerRadius="2" 
          Background="{TemplateBinding Background}"
          BorderBrush="{TemplateBinding BorderBrush}"
          BorderThickness="1" >
            <Canvas Width ="8" Height ="8" >
              <Path 
              Data ="M0,0.5 L8,0.5 M0,2.5 L8,2.5 M0,4.5 L8,4.5 M 0,6.5 L8,6.5"
              Stroke ="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarThumbGlyphBrushKey}}"/>
            </Canvas>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalThumbHoverBackgroundKey}}" />
      </Trigger>
      <Trigger Property="IsDragging" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalRepeatButtonPressedBackgroundKey}}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style TargetType ="{x:Type Thumb}" x:Key="HorizontalScrollBarThumb" BasedOn="{StaticResource ScrollBarThumb}">
        <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarThumbBackgroundKey}}"/>
    <Setter Property ="Margin" Value ="0,1,0,1"/>
    <Setter Property ="BorderBrush" Value ="{DynamicResource {x:Static oui:OfficeBrushes.NormalBorderBrushKey}  }"/>
    <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarHorizontalThumbHoverBackgroundKey}}" />
      </Trigger>
      <!-- <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ButtonHoverBackgroundKey}}" />
      </Trigger> -->
      <Trigger Property="IsDragging" Value="True">
        <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarHorizontalRepeatButtonPressedBackgroundKey}}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid >
      <Grid.RowDefinitions>
        <RowDefinition MaxHeight="18"/>
        <RowDefinition Height="0.00001*"/>
        <RowDefinition MaxHeight="18"/>
      </Grid.RowDefinitions>
      <Border
      Grid.RowSpan="3"
      CornerRadius="0" 
      Background="{TemplateBinding Background}" />
      <RepeatButton Name="firstButton" 
      Grid.Row="0" 
      Style="{StaticResource VerticalScrollBarLineButton}"
      Height="18"
      Command="ScrollBar.LineUpCommand"
      Content="M 0 4 L 8 4 L 4 0 Z" />
      <Track 
      Name="PART_Track"
      Grid.Row="1"
      IsDirectionReversed="true">
        <Track.DecreaseRepeatButton>
          <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb 
          Style="{StaticResource VerticalScrollBarThumb}">
          </Thumb>
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton Name="secondButton"
      Grid.Row="3" 
      Style="{StaticResource VerticalScrollBarLineButton}"
      Height="18"
      Command="ScrollBar.LineDownCommand"
      Content="M 0 0 L 4 4 L 8 0 Z"/>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property ="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalThumbBackgroundKey}}" TargetName="firstButton"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarVerticalThumbBackgroundKey}}" TargetName="secondButton"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid >
      <Grid.ColumnDefinitions>
        <ColumnDefinition MaxWidth="18"/>
        <ColumnDefinition Width="0.00001*"/>
        <ColumnDefinition MaxWidth="18"/>
      </Grid.ColumnDefinitions>
      <Border
      Grid.ColumnSpan="3"
      CornerRadius="2" 
      Background="{TemplateBinding Background}" />
      <RepeatButton Name="firstButton"
      Grid.Column="0" 
      Style="{StaticResource HorizontalScrollBarLineButton}"
      Width="18"
      Command="ScrollBar.LineLeftCommand"
      Content="M 4 0 L 4 8 L 0 4 Z" />
      <Track 
      Name="PART_Track"
      Grid.Column="1"
      IsDirectionReversed="False">
        <Track.DecreaseRepeatButton>
          <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageLeftCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb 
          Style="{StaticResource HorizontalScrollBarThumb}">
          </Thumb>
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageRightCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton  Name="secondButton"
      Grid.Column="3" 
      Style="{StaticResource HorizontalScrollBarLineButton}"
      Width="18"
      Command="ScrollBar.LineRightCommand"
      Content="M 0 0 L 4 4 L 0 8 Z"/>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarThumbBackgroundKey}}" TargetName="firstButton"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarThumbBackgroundKey}}" TargetName="secondButton"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style  TargetType="{x:Type ScrollBar}" x:Key="officeScrollBar">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property ="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ScrollBarBackgroundKey}}"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="18" />
        <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Width" Value="18"/>
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
      </Trigger>
    </Style.Triggers>
  </Style>
</ResourceDictionary>